from gamelib import game
from gamelib import sprites
import unittest
import pygame

class ControleerGame(unittest.TestCase):
    def setUp(self):
        self.size = width, height = 800, 600
        self.screen = pygame.display.set_mode(self.size) #retourneert Surface
        
        self.game = game.Game(self.screen)
        
    def testGameover_screen(self):
        var1 = False
        self.game.gameover_screen()
        var2 = self.game.keepGoing
        self.assertEquals(var1, var2)
        
    def testPlayerDef(self):
        var1 = pygame.sprite.RenderClear()
        self.game.space_pressed()
        self.assertEquals(self.game.ball.rect.centerx, (self.game.player.rect.centerx - 30))
    
    def testGoRight(self):
        var1 = self.game.player.rect.left
        self.game.go_horizontal(4)
        self.game.playerSprite.update()
        var2 = self.game.player.rect.left
        self.assertEquals((var1 + 4), var2)
        
    def testGoLeft(self):
        var1 = self.game.player.rect.left
        self.game.go_horizontal(-4)
        self.game.playerSprite.update()
        var2 = self.game.player.rect.left
        self.assertEquals((var1 -4), var2)
        
    def testGoUp(self):
        var1 = self.game.player.rect.top
        self.game.go_vertical(-4)
        self.game.playerSprite.update()
        var2 = self.game.player.rect.top
        self.assertEquals(var1, (var2 + 4))
        
    def testGoDown(self):
        var1 = self.game.player.rect.top
        self.game.go_vertical(4)
        self.game.playerSprite.update()
        var2 = self.game.player.rect.top
        self.assertEquals(var1, (var2 - 4))
    
unittest.main()
